from pyecharts.charts import Bar
from pyecharts import options as opts

# 数据
degrees = ["大专", "本科", "硕士", "博士", "2年经验"]
data_chengdu_data = [46, 90, 5, 0, 0]  # 假设的数据，实际应用中应替换为真实数据
data_chengdu_algorithm = [0, 120, 85, 5, 1]  # 假设的数据，实际应用中应替换为真实数据

# 创建Bar图表
bar = (
    Bar()
    .add_xaxis(degrees)
    .add_yaxis("数据成都", data_chengdu_data, color="pink")
    .add_yaxis("算法成都", data_chengdu_algorithm, color="skyblue")
    .set_global_opts(
        title_opts=opts.TitleOpts(title="叶玉婷 数据成都和算法成都学历要求"),
        legend_opts=opts.LegendOpts(is_show=True),
        yaxis_opts=opts.AxisOpts(name="人数"),
    )
    .set_series_opts(
        label_opts=opts.LabelOpts(is_show=False),
    )
)

# 渲染图表到HTML文件
bar.render("6.2(4) 成都算法.html")